#!/bin/bash
source /etc/profile
. $BEETLE_SHELL_PATH/error.sh

workPath=$1
projectName=$2
bakPath=$3
bakName=$4

# cd /usr/local/nginx
cd ${workPath} || error_exit

tar -zcf ${bakPath}/${bakName}_`date +%Y%m%d-%H%M%S`.tgz ${projectName}/  --exclude=${projectName}/*.log --exclude=${projectName}/*.log.*  || error_exit

cd ${bakPath} || error_exit

rm -rf `ls -t ${bakName}_* |tail -n+11` || error_exit

ls -alh ${bakPath}/ 